Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mixins on all shape types #1025

Merged
merged 10 commits into from
Jan 10, 2022

Conversation

JordonPhillips
Copy link
Contributor

@JordonPhillips JordonPhillips commented Dec 22, 2021

This expands mixins to allow them on any shape type.

One other thing that has been done is allowing shapes to re-define members. This could allow us to continue to require that lists / sets / maps always define their members. So instead of

list A {
    @required
    member: String
}

list B with A {}

You'd have

list A {
    @required
    member: String
}

list B with A {
    // This inherits the @required trait from A$member
    member: String
}

Trait merging works precisely like it does for the shapes themselves, which removes the need to have a bunch of awkward apply statements everywhere. The one restriction is that the target has to be the same shape.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@JordonPhillips JordonPhillips requested a review from a team as a code owner December 22, 2021 13:49
This updates mixins to allow duplicating a mixin member on a shape,
so long as the target remains the same. Members applied locally will
behave the same way as they would if they were applied with the apply
statement.
Copy link
Member

@mtdowling mtdowling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far!

designs/mixins.md Outdated Show resolved Hide resolved
designs/mixins.md Outdated Show resolved Hide resolved
designs/mixins.md Outdated Show resolved Hide resolved
designs/mixins.md Outdated Show resolved Hide resolved
designs/mixins.md Outdated Show resolved Hide resolved
@JordonPhillips JordonPhillips merged commit fe23e07 into smithy-lang:idl-2.0 Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants